<?php
!defined('P_W') && exit('Forbidden');
require_once R_P . 'lib/framework/controller.php';
class FrontController extends Controller {
	var $_layout_type = '';
	var $_layoutFile = 'second';
	
	function FrontController() {
		$this->__construct();
	}
	
	function __construct() {
		parent::__construct();
		$this->_initUserInfo();
	}
	
	function _initUserInfo() {
		global $winduid;
		$winduid = (int) $winduid;
		if (!$winduid) return false;
		$brokerService = House::loadService('brokerservice');
		$brokerInfo = $brokerService->getBroker($winduid);
		if (!$brokerInfo) return false;
		
		$brokerGroupService = House::loadService('brokergroupservice');
		$brokerInfo['right'] = $brokerGroupService->getBrokerGroupRight($brokerInfo['groupid']);
		$this->_viewer->userInfo = $brokerInfo;
	}
	
	function _setLayoutType($type){
		$this->_layout_type = $type;
	}
	
	function _output() {
		parent::_output();
		switch ($this->_layout_type) {
			case 'ajax':
				ajax_footer();
				break;
			case 'pw':
				footer();
			default:
				pwOutPut();
		}
	}
}